using System.Collections.Generic;
using System.IO;
using System.Windows.Media;
using Common;
using Common.Enum;
using Common.NotifyEvent;

namespace SSettings
{
    public class ColorSettings : NotifyPropertyChanged
    {
        private Color _GenoType1;

        private Color _GenoType2;

        private Color _GenoType3;

        private Color _GenoType4;

        private Color _GenoType5;

        private Color _GenoType6;

        private Color _GenoTypeUnknow;

        private Color _GenoTypeNegative;

        private Color _GenoADType1;

        private Color _GenoADType2;

        private Color _GenoADType3;

        private Color _GenoADBackgroud;

        private Color _GenoADTypeUnknow;

        private Color _GenoADTypeNegative;

        private Color _ColorChannel1;

        private Color _ColorChannel2;

        private Color _ColorChannel3;

        private Color _ColorChannel4;

        private Color _ColorChannel5;

        private Color _ColorChannel6;

        private Color _ColorRow1;

        private Color _ColorRow2;

        private Color _ColorRow3;

        private Color _ColorRow4;

        private Color _ColorRow5;

        private Color _ColorRow6;

        private Color _ColorRow7;

        private Color _ColorRow8;

        private Color _ColorColumn1;

        private Color _ColorColumn2;

        private Color _ColorColumn3;

        private Color _ColorColumn4;

        private Color _ColorColumn5;

        private Color _ColorColumn6;

        private Color _ColorColumn7;

        private Color _ColorColumn8;

        private Color _ColorColumn9;

        private Color _ColorColumn10;

        private Color _ColorColumn11;

        private Color _ColorColumn12;

        private Color _ColorUnknown;

        private Color _ColorStandard;

        private Color _ColorHighPositive;

        private Color _ColorLowPositive;

        private Color _ColorNegative;

        private Color _ColorNTC;

        private Color _ColorQC;

        private Color _ColorRetestSample;

        public Color GenoType1
        {
            get
            {
                return _GenoType1;
            }
            set
            {
                if (!(_GenoType1 == value))
                {
                    _GenoType1 = value;
                    OnPropertyChanged("GenoType1");
                }
            }
        }

        public Color GenoType2
        {
            get
            {
                return _GenoType2;
            }
            set
            {
                if (!(_GenoType2 == value))
                {
                    _GenoType2 = value;
                    OnPropertyChanged("GenoType2");
                }
            }
        }

        public Color GenoType3
        {
            get
            {
                return _GenoType3;
            }
            set
            {
                if (!(_GenoType3 == value))
                {
                    _GenoType3 = value;
                    OnPropertyChanged("GenoType3");
                }
            }
        }

        public Color GenoType4
        {
            get
            {
                return _GenoType4;
            }
            set
            {
                if (!(_GenoType4 == value))
                {
                    _GenoType4 = value;
                    OnPropertyChanged("GenoType4");
                }
            }
        }

        public Color GenoType5
        {
            get
            {
                return _GenoType5;
            }
            set
            {
                if (!(_GenoType5 == value))
                {
                    _GenoType5 = value;
                    OnPropertyChanged("GenoType5");
                }
            }
        }

        public Color GenoType6
        {
            get
            {
                return _GenoType6;
            }
            set
            {
                if (!(_GenoType6 == value))
                {
                    _GenoType6 = value;
                    OnPropertyChanged("GenoType6");
                }
            }
        }

        public Color GenoTypeUnknow
        {
            get
            {
                return _GenoTypeUnknow;
            }
            set
            {
                if (!(_GenoTypeUnknow == value))
                {
                    _GenoTypeUnknow = value;
                    OnPropertyChanged("GenoTypeUnknow");
                }
            }
        }

        public Color GenoTypeNegative
        {
            get
            {
                return _GenoTypeNegative;
            }
            set
            {
                if (!(_GenoTypeNegative == value))
                {
                    _GenoTypeNegative = value;
                    OnPropertyChanged("GenoTypeNegative");
                }
            }
        }

        public Color GenoADType1
        {
            get
            {
                return _GenoADType1;
            }
            set
            {
                if (!(_GenoADType1 == value))
                {
                    _GenoADType1 = value;
                    OnPropertyChanged("GenoADType1");
                }
            }
        }

        public Color GenoADType2
        {
            get
            {
                return _GenoADType2;
            }
            set
            {
                if (!(_GenoADType2 == value))
                {
                    _GenoADType2 = value;
                    OnPropertyChanged("GenoADType2");
                }
            }
        }

        public Color GenoADType3
        {
            get
            {
                return _GenoADType3;
            }
            set
            {
                if (!(_GenoADType3 == value))
                {
                    _GenoADType3 = value;
                    OnPropertyChanged("GenoADType3");
                }
            }
        }

        public Color GenoADBackgroud
        {
            get
            {
                return _GenoADBackgroud;
            }
            set
            {
                if (!(_GenoADBackgroud == value))
                {
                    _GenoADBackgroud = value;
                    OnPropertyChanged("GenoADBackgroud");
                }
            }
        }

        public Color GenoADTypeUnknow
        {
            get
            {
                return _GenoADTypeUnknow;
            }
            set
            {
                if (!(_GenoADTypeUnknow == value))
                {
                    _GenoADTypeUnknow = value;
                    OnPropertyChanged("GenoADTypeUnknow");
                }
            }
        }

        public Color GenoADTypeNegative
        {
            get
            {
                return _GenoADTypeNegative;
            }
            set
            {
                if (!(_GenoADTypeNegative == value))
                {
                    _GenoADTypeNegative = value;
                    OnPropertyChanged("GenoADTypeNegative");
                }
            }
        }

        public Color ColorChannel1
        {
            get
            {
                return _ColorChannel1;
            }
            set
            {
                if (!(_ColorChannel1 == value))
                {
                    _ColorChannel1 = value;
                    OnPropertyChanged("ColorChannel1");
                }
            }
        }

        public Color ColorChannel2
        {
            get
            {
                return _ColorChannel2;
            }
            set
            {
                if (!(_ColorChannel2 == value))
                {
                    _ColorChannel2 = value;
                    OnPropertyChanged("ColorChannel2");
                }
            }
        }

        public Color ColorChannel3
        {
            get
            {
                return _ColorChannel3;
            }
            set
            {
                if (!(_ColorChannel3 == value))
                {
                    _ColorChannel3 = value;
                    OnPropertyChanged("ColorChannel3");
                }
            }
        }

        public Color ColorChannel4
        {
            get
            {
                return _ColorChannel4;
            }
            set
            {
                if (!(_ColorChannel4 == value))
                {
                    _ColorChannel4 = value;
                    OnPropertyChanged("ColorChannel4");
                }
            }
        }

        public Color ColorChannel5
        {
            get
            {
                return _ColorChannel5;
            }
            set
            {
                if (!(_ColorChannel5 == value))
                {
                    _ColorChannel5 = value;
                    OnPropertyChanged("ColorChannel5");
                }
            }
        }

        public Color ColorChannel6
        {
            get
            {
                return _ColorChannel6;
            }
            set
            {
                if (!(_ColorChannel6 == value))
                {
                    _ColorChannel6 = value;
                    OnPropertyChanged("ColorChannel6");
                }
            }
        }

        public Color ColorRow1
        {
            get
            {
                return _ColorRow1;
            }
            set
            {
                if (!(_ColorRow1 == value))
                {
                    _ColorRow1 = value;
                    OnPropertyChanged("ColorRow1");
                }
            }
        }

        public Color ColorRow2
        {
            get
            {
                return _ColorRow2;
            }
            set
            {
                if (!(_ColorRow2 == value))
                {
                    _ColorRow2 = value;
                    OnPropertyChanged("ColorRow2");
                }
            }
        }

        public Color ColorRow3
        {
            get
            {
                return _ColorRow3;
            }
            set
            {
                if (!(_ColorRow3 == value))
                {
                    _ColorRow3 = value;
                    OnPropertyChanged("ColorRow3");
                }
            }
        }

        public Color ColorRow4
        {
            get
            {
                return _ColorRow4;
            }
            set
            {
                if (!(_ColorRow4 == value))
                {
                    _ColorRow4 = value;
                    OnPropertyChanged("ColorRow4");
                }
            }
        }

        public Color ColorRow5
        {
            get
            {
                return _ColorRow5;
            }
            set
            {
                if (!(_ColorRow5 == value))
                {
                    _ColorRow5 = value;
                    OnPropertyChanged("ColorRow5");
                }
            }
        }

        public Color ColorRow6
        {
            get
            {
                return _ColorRow6;
            }
            set
            {
                if (!(_ColorRow6 == value))
                {
                    _ColorRow6 = value;
                    OnPropertyChanged("ColorRow6");
                }
            }
        }

        public Color ColorRow7
        {
            get
            {
                return _ColorRow7;
            }
            set
            {
                if (!(_ColorRow7 == value))
                {
                    _ColorRow7 = value;
                    OnPropertyChanged("ColorRow7");
                }
            }
        }

        public Color ColorRow8
        {
            get
            {
                return _ColorRow8;
            }
            set
            {
                if (!(_ColorRow8 == value))
                {
                    _ColorRow8 = value;
                    OnPropertyChanged("ColorRow8");
                }
            }
        }

        public Color ColorColumn1
        {
            get
            {
                return _ColorColumn1;
            }
            set
            {
                if (!(_ColorColumn1 == value))
                {
                    _ColorColumn1 = value;
                    OnPropertyChanged("ColorColumn1");
                }
            }
        }

        public Color ColorColumn2
        {
            get
            {
                return _ColorColumn2;
            }
            set
            {
                if (!(_ColorColumn2 == value))
                {
                    _ColorColumn2 = value;
                    OnPropertyChanged("ColorColumn2");
                }
            }
        }

        public Color ColorColumn3
        {
            get
            {
                return _ColorColumn3;
            }
            set
            {
                if (!(_ColorColumn3 == value))
                {
                    _ColorColumn3 = value;
                    OnPropertyChanged("ColorColumn3");
                }
            }
        }

        public Color ColorColumn4
        {
            get
            {
                return _ColorColumn4;
            }
            set
            {
                if (!(_ColorColumn4 == value))
                {
                    _ColorColumn4 = value;
                    OnPropertyChanged("ColorColumn4");
                }
            }
        }

        public Color ColorColumn5
        {
            get
            {
                return _ColorColumn5;
            }
            set
            {
                if (!(_ColorColumn5 == value))
                {
                    _ColorColumn5 = value;
                    OnPropertyChanged("ColorColumn5");
                }
            }
        }

        public Color ColorColumn6
        {
            get
            {
                return _ColorColumn6;
            }
            set
            {
                if (!(_ColorColumn6 == value))
                {
                    _ColorColumn6 = value;
                    OnPropertyChanged("ColorColumn6");
                }
            }
        }

        public Color ColorColumn7
        {
            get
            {
                return _ColorColumn7;
            }
            set
            {
                if (!(_ColorColumn7 == value))
                {
                    _ColorColumn7 = value;
                    OnPropertyChanged("ColorColumn7");
                }
            }
        }

        public Color ColorColumn8
        {
            get
            {
                return _ColorColumn8;
            }
            set
            {
                if (!(_ColorColumn8 == value))
                {
                    _ColorColumn8 = value;
                    OnPropertyChanged("ColorColumn8");
                }
            }
        }

        public Color ColorColumn9
        {
            get
            {
                return _ColorColumn9;
            }
            set
            {
                if (!(_ColorColumn9 == value))
                {
                    _ColorColumn9 = value;
                    OnPropertyChanged("ColorColumn9");
                }
            }
        }

        public Color ColorColumn10
        {
            get
            {
                return _ColorColumn10;
            }
            set
            {
                if (!(_ColorColumn10 == value))
                {
                    _ColorColumn10 = value;
                    OnPropertyChanged("ColorColumn10");
                }
            }
        }

        public Color ColorColumn11
        {
            get
            {
                return _ColorColumn11;
            }
            set
            {
                if (!(_ColorColumn11 == value))
                {
                    _ColorColumn11 = value;
                    OnPropertyChanged("ColorColumn11");
                }
            }
        }

        public Color ColorColumn12
        {
            get
            {
                return _ColorColumn12;
            }
            set
            {
                if (!(_ColorColumn12 == value))
                {
                    _ColorColumn12 = value;
                    OnPropertyChanged("ColorColumn12");
                }
            }
        }

        public Color ColorUnknown
        {
            get
            {
                return _ColorUnknown;
            }
            set
            {
                if (!(_ColorUnknown == value))
                {
                    _ColorUnknown = value;
                    OnPropertyChanged("ColorUnknown");
                }
            }
        }

        public Color ColorStandard
        {
            get
            {
                return _ColorStandard;
            }
            set
            {
                if (!(_ColorStandard == value))
                {
                    _ColorStandard = value;
                    OnPropertyChanged("ColorStandard");
                }
            }
        }

        public Color ColorHighPositive
        {
            get
            {
                return _ColorHighPositive;
            }
            set
            {
                if (!(_ColorHighPositive == value))
                {
                    _ColorHighPositive = value;
                    OnPropertyChanged("ColorHighPositive");
                }
            }
        }

        public Color ColorLowPositive
        {
            get
            {
                return _ColorLowPositive;
            }
            set
            {
                if (!(_ColorLowPositive == value))
                {
                    _ColorLowPositive = value;
                    OnPropertyChanged("ColorLowPositive");
                }
            }
        }

        public Color ColorNegative
        {
            get
            {
                return _ColorNegative;
            }
            set
            {
                if (!(_ColorNegative == value))
                {
                    _ColorNegative = value;
                    OnPropertyChanged("ColorNegative");
                }
            }
        }

        public Color ColorNTC
        {
            get
            {
                return _ColorNTC;
            }
            set
            {
                if (!(_ColorNTC == value))
                {
                    _ColorNTC = value;
                    OnPropertyChanged("ColorNTC");
                }
            }
        }

        public Color ColorQC
        {
            get
            {
                return _ColorQC;
            }
            set
            {
                if (!(_ColorQC == value))
                {
                    _ColorQC = value;
                    OnPropertyChanged("ColorQC");
                }
            }
        }

        public Color ColorRetestSample
        {
            get
            {
                return _ColorRetestSample;
            }
            set
            {
                if (!(_ColorRetestSample == value))
                {
                    _ColorRetestSample = value;
                    OnPropertyChanged("ColorRetestSample");
                }
            }
        }

        public ColorSettings()
        {
            SetDefault();
        }

        public void RaiseUpdateEvent()
        {
            OnPropertyChanged("UpdateColor");
        }

        public Color GetChannelColor(int channelNo)
        {
            switch (channelNo)
            {
                case 1:
                    return ColorChannel1;
                case 2:
                    return ColorChannel2;
                case 3:
                    return ColorChannel3;
                case 4:
                    return ColorChannel4;
                case 5:
                    return ColorChannel5;
                case 6:
                    return ColorChannel6;
                default:
                    return Colors.Black;
            }
        }

        public ColorSettings Clone()
        {
            ColorSettings colorSettings = new ColorSettings();
            colorSettings.Copy(this);
            return colorSettings;
        }

        public void Copy(ColorSettings settings)
        {
            StreamEx streamEx = new StreamEx();
            settings.SaveToStream(streamEx);
            streamEx.Seek(0L, SeekOrigin.Begin);
            ReadFromStream(streamEx);
            streamEx.Close();
        }

        public void SetDefault()
        {
            GenoType1 = Utility.GetDrawingGenoTypeColor(EGenoType.GenoType1);
            GenoType2 = Utility.GetDrawingGenoTypeColor(EGenoType.GenoType2);
            GenoType3 = Utility.GetDrawingGenoTypeColor(EGenoType.GenoType3);
            GenoType4 = Utility.GetDrawingGenoTypeColor(EGenoType.GenoType4);
            GenoType5 = Utility.GetDrawingGenoTypeColor(EGenoType.GenoType5);
            GenoType6 = Utility.GetDrawingGenoTypeColor(EGenoType.GenoType6);
            GenoTypeUnknow = Utility.GetDrawingGenoTypeColor(EGenoType.GenoUnknown);
            GenoTypeNegative = Utility.GetDrawingGenoTypeColor(EGenoType.GenoNegative);
            GenoADType1 = Utility.GetDrawingADGenoTypeColor(EADGenoType.GenoType1);
            GenoADType2 = Utility.GetDrawingADGenoTypeColor(EADGenoType.GenoType2);
            GenoADType3 = Utility.GetDrawingADGenoTypeColor(EADGenoType.GenoType3);
            GenoADTypeUnknow = Utility.GetDrawingADGenoTypeColor(EADGenoType.GenoUnknown);
            GenoADTypeNegative = Utility.GetDrawingADGenoTypeColor(EADGenoType.GenoNegative);
            ColorChannel1 = Utility.GetChannelColor(1);
            ColorChannel2 = Utility.GetChannelColor(2);
            ColorChannel3 = Utility.GetChannelColor(3);
            ColorChannel4 = Utility.GetChannelColor(4);
            ColorChannel5 = Utility.GetChannelColor(5);
            ColorChannel6 = Utility.GetChannelColor(6);
            ColorRow1 = Utility.GetRowColor(1);
            ColorRow2 = Utility.GetRowColor(2);
            ColorRow3 = Utility.GetRowColor(3);
            ColorRow4 = Utility.GetRowColor(4);
            ColorRow5 = Utility.GetRowColor(5);
            ColorRow6 = Utility.GetRowColor(6);
            ColorRow7 = Utility.GetRowColor(7);
            ColorRow8 = Utility.GetRowColor(8);
            ColorColumn1 = Utility.GetColumnColor(1);
            ColorColumn2 = Utility.GetColumnColor(2);
            ColorColumn3 = Utility.GetColumnColor(3);
            ColorColumn4 = Utility.GetColumnColor(4);
            ColorColumn5 = Utility.GetColumnColor(5);
            ColorColumn6 = Utility.GetColumnColor(6);
            ColorColumn7 = Utility.GetColumnColor(7);
            ColorColumn8 = Utility.GetColumnColor(8);
            ColorColumn9 = Utility.GetColumnColor(9);
            ColorColumn10 = Utility.GetColumnColor(10);
            ColorColumn11 = Utility.GetColumnColor(11);
            ColorColumn12 = Utility.GetColumnColor(12);
            ColorUnknown = Utility.GetSampleColor(SampleType.Unknown);
            ColorStandard = Utility.GetSampleColor(SampleType.Standard);
            ColorHighPositive = Utility.GetSampleColor(SampleType.HighPositive);
            ColorLowPositive = Utility.GetSampleColor(SampleType.LowPositive);
            ColorNegative = Utility.GetSampleColor(SampleType.Negative);
            ColorNTC = Utility.GetSampleColor(SampleType.NTC);
            ColorQC = Utility.GetSampleColor(SampleType.QC);
            ColorRetestSample = Utility.GetSampleColor(SampleType.RetestSample);
        }

        public void SaveToStream(StreamEx stream)
        {
            stream.Write(PropertyKey.Key_ColorSettings);
            List<PropertyKey> list = new List<PropertyKey>();
            List<byte[]> list2 = new List<byte[]>();
            list.Add(PropertyKey.Key_ColorChannel1);
            list2.Add(BytesConverter.GetBytes(ColorChannel1.ToString()));
            list.Add(PropertyKey.Key_ColorChannel2);
            list2.Add(BytesConverter.GetBytes(ColorChannel2.ToString()));
            list.Add(PropertyKey.Key_ColorChannel3);
            list2.Add(BytesConverter.GetBytes(ColorChannel3.ToString()));
            list.Add(PropertyKey.Key_ColorChannel4);
            list2.Add(BytesConverter.GetBytes(ColorChannel4.ToString()));
            list.Add(PropertyKey.Key_ColorChannel5);
            list2.Add(BytesConverter.GetBytes(ColorChannel5.ToString()));
            list.Add(PropertyKey.Key_ColorChannel6);
            list2.Add(BytesConverter.GetBytes(ColorChannel6.ToString()));
            stream.Write(PropertyKey.Key_Index);
            stream.WriteIndex(list, list2);
            stream.Flush();
        }

        public bool ReadFromStream(StreamEx stream)
        {
            PropertyKey propertyKey = stream.ReadKey();
            if (propertyKey != PropertyKey.Key_ColorSettings)
            {
                stream.Seek(-4L, SeekOrigin.Current);
                return false;
            }
            propertyKey = stream.ReadKey();
            if (propertyKey == PropertyKey.Key_Index)
            {
                List<PropertyKey> keys;
                List<byte[]> dates;
                stream.ReadIndex(out keys, out dates);
                for (int i = 0; i < keys.Count; i++)
                {
                    switch (keys[i])
                    {
                        case PropertyKey.Key_ColorGenoType1:
                            GenoType1 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoType2:
                            GenoType2 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoType3:
                            GenoType3 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoType4:
                            GenoType4 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoType5:
                            GenoType5 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoType6:
                            GenoType6 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoTypeUnknow:
                            GenoTypeUnknow = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoTypeNegative:
                            GenoTypeNegative = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoADType1:
                            GenoADType1 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoADType2:
                            GenoADType2 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoADType3:
                            GenoADType3 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoADTypeUnknow:
                            GenoADTypeUnknow = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorGenoADTypeNegative:
                            GenoADTypeNegative = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorChannel1:
                            ColorChannel1 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorChannel2:
                            ColorChannel2 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorChannel3:
                            ColorChannel3 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorChannel4:
                            ColorChannel4 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorChannel5:
                            ColorChannel5 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorChannel6:
                            ColorChannel6 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow1:
                            ColorRow1 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow2:
                            ColorRow2 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow3:
                            ColorRow3 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow4:
                            ColorRow4 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow5:
                            ColorRow5 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow6:
                            ColorRow6 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow7:
                            ColorRow7 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRow8:
                            ColorRow8 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn1:
                            ColorColumn1 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn2:
                            ColorColumn2 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn3:
                            ColorColumn3 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn4:
                            ColorColumn4 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn5:
                            ColorColumn5 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn6:
                            ColorColumn6 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn7:
                            ColorColumn7 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn8:
                            ColorColumn8 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn9:
                            ColorColumn9 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn10:
                            ColorColumn10 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn11:
                            ColorColumn11 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorColumn12:
                            ColorColumn12 = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorUnknown:
                            ColorUnknown = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorStandard:
                            ColorStandard = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorHighPositive:
                            ColorHighPositive = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorLowPositive:
                            ColorLowPositive = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorNegative:
                            ColorNegative = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorNTC:
                            ColorNTC = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorQC:
                            ColorQC = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                        case PropertyKey.Key_ColorRetestSample:
                            ColorRetestSample = Utility.ConvertColorFromString(BytesConverter.BytesToString(dates[i]));
                            break;
                    }
                }
            }
            return true;
        }
    }
}
